package top.songxs.gmall.product.rpc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.songxs.gmall.common.result.Result;
import top.songxs.gmall.product.entity.SkuInfo;
import top.songxs.gmall.product.rpc.biz.SkuInfoFeignRpcService;

import java.util.List;

@RestController
@RequestMapping("api/inner/product")
public class SkuInfoFeignRpcController {
    @Autowired
    private SkuInfoFeignRpcService skuInfoFeignRpcService;


    @GetMapping("getSkuInfo/{skuId}")
    public Result<SkuInfo> getSkuInfo(@PathVariable("skuId") Long skuId){
        SkuInfo skuInfo = skuInfoFeignRpcService.getSkuInfo(skuId);
        return Result.ok(skuInfo);
    }


    @GetMapping("getPrice/{skuId}")
    public Result<SkuInfo> getPrice(@PathVariable("skuId") Long skuId){
        SkuInfo skuInfo = skuInfoFeignRpcService.getPrice(skuId);
        return Result.ok(skuInfo);
    }
    @GetMapping("/getAllSkuId")
    public Result<List<Long>> getAllSkuId(){
        return skuInfoFeignRpcService.getAllSkuId();
    }

}
